
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.List;

import com.swf.common.utils.FwsFileUtils;
import com.swf.common.utils.FwsIOUtils;
import com.swf.common.utils.FwsPatternUtils;

public class Filedeal {
	public static void main(String[] args) throws IOException {
		File file = new File("D:/55_932_11_20140520_001");
		String content = FwsFileUtils.loadFile(file, "GBK");
		List<String> list = FwsPatternUtils.matchedList(content, ".+");
		FwsIOUtils io = new FwsIOUtils();
		io.setAppend(true);
		File out = new File("55_932_11_20140520_001bak");
		out.delete();
		io.setOutPath("d:/55_932_11_20140520_001bak");
		for (int i=0;i<list.size();i++){
			if (i==0||i==(list.size()-1)){
				io.setContent(list.get(i)+"\n");
				io.write();
				
			}else{
				String line = list.get(i);
				String head = line.substring(0,68);
				String acco = line.substring(68, 85);
				String foot = line.substring(85);
				System.out.println(add(acco,17));
				io.setContent(head+add(acco,17)+foot+"\n");
				io.write();
			}
		}
	}
	
	public static String add(String s,int n){
		s = s.trim();
		while (s.length()<17){
			s = s+" ";
		}
		return s;
	}
}
